function addReply(id){
	if($("#addReply"+id).attr('class')=='diplayNone'){
		$("#addReply"+id).attr('class','fbTexc');
	}else{
		$("#addReply"+id).attr('class','diplayNone');
	}
}

function submitReply(id){
	var reply = $("#reply"+id).val();
	if(reply==null||reply==''){
		alert("回复内容不能为空");
		return;
	}
	$("#addReplyForm"+id).submit();
}

function submitComment(){
	var comment = $("#articleComment").val();
	if(comment==null||comment==''){
		alert("评论内容不能为空");
		return;
	}
	$("#addCommentForm").submit();
}

function addSubjectAttention(id){
	$.getJSON("/topic/addSubjectAttention.json",{subjectid: id}, function(result) {
		if(result.flag==0){
			window.top.location.reload();
		}else{
			alert(result.message);
		}
	});
}

function cancelSubjectAttention(id){
	var cf = confirm("您确认取消关注吗？");
	if(!cf){
		return;
	}
	$.getJSON("/topic/cancelSubjectAttention.json",{subjectid: id}, function(result) {
		if(result.flag==0){
			window.top.location.reload();
		}else{
			alert(result.message);
		}
	});
}

function updateArticleStatus(articleid, status){
	var text = "";
	if(status==0){
		text = "取消发布";
	}else if(status==1){
		text = "发布";
	}else if(status==-1){
		text = "删除";
	}else {
		alert("参数错误！");
		return;
	}
	var cf = confirm("您确定要"+text+"文章吗？");
	if(!cf){
		return;
	}
	$.getJSON("/topic/updateArticleStatus.json",{articleid: articleid, status:status}, function(result) {
		if(result.flag==0){
			window.top.location.reload();
		}else{
			alert(result.message);
		}
	});
}





